package de.so.myteach;
import android.app.ActionBar;
import android.content.Intent;
import android.os.Bundle;
import android.support.v4.app.FragmentActivity;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentTransaction;
import android.support.v4.app.NavUtils;
import android.view.MenuItem;

import de.so.myteach.R;

public class PupilDetailActivity extends FragmentActivity
{
  protected void onCreate(Bundle paramBundle)
  {
    super.onCreate(paramBundle);
    setContentView(R.layout.activity_pupil_detail);
    getActionBar().setDisplayHomeAsUpEnabled(true);
    if (paramBundle == null)
    {
      Bundle bundle = new Bundle();
      bundle.putString("item_id", getIntent().getStringExtra("item_id"));
      PupilDetailFragment PupilDetail = new PupilDetailFragment();
      PupilDetail.setArguments(bundle);
      getSupportFragmentManager().beginTransaction().add(R.id.pupil_detail_container, PupilDetail).commit();
    }
  }

    @Override
    public boolean onOptionsItemSelected(MenuItem item) {
        switch (item.getItemId()) {
            // Respond to the action bar's Up/Home button
            case android.R.id.home:
                NavUtils.navigateUpFromSameTask(this);
                return true;
        }
        return super.onOptionsItemSelected(item);
    }
}